package com.cnap.multiclouldmgmt.model.microSvc;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;

/**
 * 拆分的微服务信息
 *
 * @author xc
 **/
@ApiModel(value = "com.cnap.multiclouldmgmt.model.microSvc.MicroSvcDataSaveModel",description = "微服务相关的数据保存")
public class MicroSvcDataSaveModel {

    //id
    @ApiModelProperty(value = "id")
    private String id;

    //集群名称
    @ApiModelProperty(value = "微服务id")
    private String cloudVendor;

    //集群名称
    @ApiModelProperty(value = "微服务id")
    private String microSvcId;

    //集群名称
    @ApiModelProperty(value = "集群Ip")
    private String k8sClusterIp;

    //集群名称
    @ApiModelProperty(value = "集群名称")
    private String k8sClusterName;

    //集群服务的名称
    @ApiModelProperty(value = "微服务名称")
    private String microSvcName;

    //集群服务的名称
    @ApiModelProperty(value = "微服务的对应的svcname")
    private String svcName;

    //容器信息
    @ApiModelProperty(value = "容器信息")
    private String podName;

    //cpu总核数，单位m，1000m为一核
    @ApiModelProperty(value = "cpu总核数")
    private int cpuTotal;

    //cpu总使用，单位m
    @ApiModelProperty(value = "cpu总核数")
    private int cpuUse;

    //mem总量，单位mb
    @ApiModelProperty(value = "mem总量，单位mb")
    private int memTotal;

    //mem使用量，单位m
    @ApiModelProperty(value = "mem使用量，单位mb")
    private int memUse;

    //记录时间
    @ApiModelProperty(value = "记录时间")
    private Date recordTime;

    //cpu使用率
    @ApiModelProperty(value = "cpu使用率")
    private int cpuPercent;

    //mem使用率
    @ApiModelProperty(value = "mem使用率")
    private int memPercent;

    @ApiModelProperty(value = "硬盘的iops")
    private int diskIops;

    @ApiModelProperty(value = "硬盘读写速率，mb/s")
    private int diskThroughput;

    @ApiModelProperty(value = "网络带宽，mbps")
    private int netBandwidth;

    @ApiModelProperty(value = "微服务过去5分钟是否发生过请求，0没有1有")
    private int reqFlag;

    //cpu总核数，单位m，1000m为一核
    @ApiModelProperty(value = "cpu总核数,double")
    private double cpuTotalNum;

    //cpu总使用，单位m
    @ApiModelProperty(value = "cpu总核数double")
    private double cpuUseNum;


    @ApiModelProperty(value = "gpu内存,G单位")
    private double gpuMemory;

    //cpu总使用，单位m
    @ApiModelProperty(value = "gpu温度")
    private double gpuTemp;

    //gpu使用率
    @ApiModelProperty(value = "gpu使用率")
    private double gpuUsage;

    //gpu显存使用率
    @ApiModelProperty(value = "gpu显存使用率")
    private double gpuMemUsage;


    /**
     * get
     *
     * @return GpuMemUsage
     */
    public double getGpuMemUsage() {
        return gpuMemUsage;
    }

    /**
     * set
     *
     * @param gpuMemUsage gpuMemUsage
     */
    public void setGpuMemUsage(double gpuMemUsage) {
        this.gpuMemUsage = gpuMemUsage;
    }

    /**
     * get
     *
     * @return GpuUsage
     */
    public double getGpuUsage() {
        return gpuUsage;
    }

    /**
     * set
     *
     * @param gpuUsage gpuUsage
     */
    public void setGpuUsage(double gpuUsage) {
        this.gpuUsage = gpuUsage;
    }

    /**
     * get
     *
     * @return GpuMemory
     */
    public double getGpuMemory() {
        return gpuMemory;
    }

    /**
     * set
     *
     * @param gpuMemory gpuMemory
     */
    public void setGpuMemory(double gpuMemory) {
        this.gpuMemory = gpuMemory;
    }

    /**
     * get
     *
     * @return GpuTemp
     */
    public double getGpuTemp() {
        return gpuTemp;
    }

    /**
     * set
     *
     * @param gpuTemp gpuTemp
     */
    public void setGpuTemp(double gpuTemp) {
        this.gpuTemp = gpuTemp;
    }

    /**
     * get
     *
     * @return CpuTotalNum
     */
    public double getCpuTotalNum() {

        return (double)cpuTotal/1000;
    }

    /**
     * set
     *
     * @param cpuTotalNum cpuTotalNum
     */
    public void setCpuTotalNum(double cpuTotalNum) {
        this.cpuTotalNum = cpuTotalNum;
    }

    /**
     * get
     *
     * @return CpuUseNum
     */
    public double getCpuUseNum() {
        return (double)cpuUse/1000;
    }

    /**
     * set
     *
     * @param cpuUseNum cpuUseNum
     */
    public void setCpuUseNum(double cpuUseNum) {
        this.cpuUseNum = cpuUseNum;
    }

    /**
     * get
     *
     * @return ReqFlag
     */
    public int getReqFlag() {
        return reqFlag;
    }

    /**
     * set
     *
     * @param reqFlag reqFlag
     */
    public void setReqFlag(int reqFlag) {
        this.reqFlag = reqFlag;
    }

    /**
     * get
     *
     * @return DiskIops
     */
    public int getDiskIops() {
        return diskIops;
    }

    /**
     * set
     *
     * @param diskIops diskIops
     */
    public void setDiskIops(int diskIops) {
        this.diskIops = diskIops;
    }

    /**
     * get
     *
     * @return DiskThroughput
     */
    public int getDiskThroughput() {
        return diskThroughput;
    }

    /**
     * set
     *
     * @param diskThroughput diskThroughput
     */
    public void setDiskThroughput(int diskThroughput) {
        this.diskThroughput = diskThroughput;
    }

    /**
     * get
     *
     * @return NetBandwidth
     */
    public int getNetBandwidth() {
        return netBandwidth;
    }

    /**
     * set
     *
     * @param netBandwidth netBandwidth
     */
    public void setNetBandwidth(int netBandwidth) {
        this.netBandwidth = netBandwidth;
    }

    /**
     * get
     *
     * @return CloudVendor
     */
    public String getCloudVendor() {
        return cloudVendor;
    }

    /**
     * set
     *
     * @param cloudVendor cloudVendor
     */
    public void setCloudVendor(String cloudVendor) {
        this.cloudVendor = cloudVendor;
    }

    /**
     * get
     *
     * @return K8sClusterName
     */
    public String getK8sClusterName() {
        return k8sClusterName;
    }

    /**
     * set
     *
     * @param k8sClusterName k8sClusterName
     */
    public void setK8sClusterName(String k8sClusterName) {
        this.k8sClusterName = k8sClusterName;
    }

    /**
     * get
     *
     * @return CpuPercent
     */
    public int getCpuPercent() {

        if ((cpuPercent == 0)&&(cpuTotal != 0)){

            cpuPercent = (int)(((float)cpuUse/(float)cpuTotal)*100);
        }

        return cpuPercent;
    }

    /**
     * set
     *
     * @param cpuPercent cpuPercent
     */
    public void setCpuPercent(int cpuPercent) {
        this.cpuPercent = cpuPercent;
    }

    /**
     * get
     *
     * @return MemPercent
     */
    public int getMemPercent() {

        if ((memPercent == 0)&&(memTotal != 0)){
            memPercent = (int)(((float)memUse/(float)memTotal)*100);
        }

        return memPercent;
    }

    /**
     * set
     *
     * @param memPercent memPercent
     */
    public void setMemPercent(int memPercent) {
        this.memPercent = memPercent;
    }

    /**
     * get
     *
     * @return Id
     */
    public String getId() {
        return id;
    }

    /**
     * set
     *
     * @param id id
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * get
     *
     * @return K8sClusterIp
     */
    public String getK8sClusterIp() {
        return k8sClusterIp;
    }

    /**
     * set
     *
     * @param k8sClusterIp k8sClusterIp
     */
    public void setK8sClusterIp(String k8sClusterIp) {
        this.k8sClusterIp = k8sClusterIp;
    }

    /**
     * get
     *
     * @return MicroSvcId
     */
    public String getMicroSvcId() {
        return microSvcId;
    }

    /**
     * set
     *
     * @param microSvcId microSvcId
     */
    public void setMicroSvcId(String microSvcId) {
        this.microSvcId = microSvcId;
    }

    /**
     * get
     *
     * @return MicroSvcName
     */
    public String getMicroSvcName() {
        return microSvcName;
    }

    /**
     * set
     *
     * @param microSvcName microSvcName
     */
    public void setMicroSvcName(String microSvcName) {
        this.microSvcName = microSvcName;
    }

    /**
     * get
     *
     * @return SvcName
     */
    public String getSvcName() {
        return svcName;
    }

    /**
     * set
     *
     * @param svcName svcName
     */
    public void setSvcName(String svcName) {
        this.svcName = svcName;
    }

    /**
     * get
     *
     * @return PodName
     */
    public String getPodName() {
        return podName;
    }

    /**
     * set
     *
     * @param podName podName
     */
    public void setPodName(String podName) {
        this.podName = podName;
    }

    /**
     * get
     *
     * @return CpuTotal
     */
    public int getCpuTotal() {
        return cpuTotal;
    }

    /**
     * set
     *
     * @param cpuTotal cpuTotal
     */
    public void setCpuTotal(int cpuTotal) {
        this.cpuTotal = cpuTotal;
    }

    /**
     * get
     *
     * @return CpuUse
     */
    public int getCpuUse() {
        return cpuUse;
    }

    /**
     * set
     *
     * @param cpuUse cpuUse
     */
    public void setCpuUse(int cpuUse) {
        this.cpuUse = cpuUse;
    }

    /**
     * get
     *
     * @return MemTotal
     */
    public int getMemTotal() {
        return memTotal;
    }

    /**
     * set
     *
     * @param memTotal memTotal
     */
    public void setMemTotal(int memTotal) {
        this.memTotal = memTotal;
    }

    /**
     * get
     *
     * @return MemUse
     */
    public int getMemUse() {
        return memUse;
    }

    /**
     * set
     *
     * @param memUse memUse
     */
    public void setMemUse(int memUse) {
        this.memUse = memUse;
    }

    /**
     * get
     *
     * @return RecordTime
     */
    public Date getRecordTime() {
        return recordTime;
    }

    /**
     * set
     *
     * @param recordTime recordTime
     */
    public void setRecordTime(Date recordTime) {
        this.recordTime = recordTime;
    }
}
